The phrase "to attach the legs" means connecting or fixing the legs of something, like a table or chair, to its main body or base, so that it becomes stable and can stand upright.